package com.muyu.controller;

import com.muyu.entity.LogInfo;
import com.muyu.service.ILogInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @ClassName: ThymeleafController
 * @Author: Zirun.Xin
 * @Date: 2025/2/10 11:21
 * @Version: 1.0
 * @Description: thymeleaf模板引擎控制层
 */
@Component
@RequiredArgsConstructor
@RequestMapping(value = "/page")
public class ThymeleafController {

    /**
     * 日志信息业务层
     */
    private final ILogInfoService logInfoService;

    @RequestMapping(value = "/logList.html")
    public String getArticles(Model model) {
        // 获取日志列表
        List<LogInfo> logInfoList = logInfoService.list();
        // 存入数据
        model.addAttribute("list", logInfoList);
        return "logList";
    }
}
